#ifndef WEAK_LEARNER_H_
#define WEAK_LEARNER_H_

#include "ZMLAlgorithm.h"
#include <iostream>

GLOBAL_NAMESPACE_BEGIN

NAMESPACE_MACHINE_LEARNING_BEGIN

class WeakLearner
{
public:
    WeakLearner(){}
    ~WeakLearner(){}

    // training
    virtual int     train(const Eigen::MatrixXd& trainData, const Eigen::VectorXi& labels, const Eigen::MatrixXd& weights) = 0;
    virtual double  evalError(const Eigen::MatrixXd& data, const Eigen::VectorXi& labels, const Eigen::MatrixXd& weights) const = 0;

    // predict
    virtual int     predict(const Eigen::RowVectorXd& oneData) const = 0;
    virtual double  evaluate(const Eigen::RowVectorXd& oneData, int classIdx) const = 0;
    virtual double  evaluate(const Eigen::MatrixXd& data, int dataIdx, int classIdx) const = 0;
    virtual int     getLabelResponse(int label) const { return 0; }

    // IO
    virtual void output(std::ostream& out){}
};

static std::ostream& operator<<(std::ostream& out, WeakLearner* learner)
{
    learner->output(out);
    return out;
}

NAMESPACE_MACHINE_LEARNING_END

GLOBAL_NAMESPACE_END

#endif//WEAK_LEARNER_H_